package com.omt.tarjimdinek.domain.tv.controller;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.context.annotation.Scope;

import com.omt.tarjimdinek.domain.tv.entity.Chaine;
import com.omt.tarjimdinek.domain.tv.service.ChaineRepository;

/**
 * Simple pass over to access static 'chaineUtil'from EL.
 * Keeps also the user's preferred locale.
 *
 * @see org.springframework.security.web.authentication.AnonymousAuthenticationFilter
 */
@Named("channelUtil")
@Scope("session")
public class ChaineController {

	private List<Chaine> listeChaine;
	
	@Inject
	private ChaineRepository chaineRepository;
	
	public List<Chaine> getAllChannels(){
		if(listeChaine == null){
			listeChaine = chaineRepository.findAll();
		}
		return listeChaine;
	}
	
	/**
	 * @return the chaineRepository
	 */
	public ChaineRepository getChaineRepository() {
		return chaineRepository;
	}

	/**
	 * @param chaineRepository the chaineRepository to set
	 */
	public void setChaineRepository(ChaineRepository chaineRepository) {
		this.chaineRepository = chaineRepository;
	}
}
